﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Vds2465Telegrams;

namespace Vds2465Parser
{
	/// <summary>
	/// This class takes care of generating and parsing bytes for the returning - variable length - RESPOND_NDAT telegram
	/// </summary>
	internal static class GenParse_Returning_RESPOND_NDAT
	{
		internal static byte[] GenerateBytes(Telegram_Returning_RESPOND_NDAT telegramReturningRESPONDNDAT)
		{
			return GenParse_VariableLength_Returning.GenerateBytes(telegramReturningRESPONDNDAT);
		}

		internal static Telegram_Returning_RESPOND_NDAT ParseBytes(byte[] telegramBytes, eDirection direction, bool accessDemandFlag, bool dataFlowControlStopFlag)
		{
			byte address = telegramBytes[VariableLength.PositionOfAddressByte];

			UserDataColl userDataColl = GenParse_VariableLength_Returning.ParseBytes(telegramBytes);

			Telegram_Returning_RESPOND_NDAT telegramReturningRespondNdat = new Telegram_Returning_RESPOND_NDAT(direction, address, accessDemandFlag, dataFlowControlStopFlag, userDataColl);

			return telegramReturningRespondNdat;
		}
	}
}
